home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / QuickDraw GX / Programming Stuff / GX Libraries / LayoutLibrary.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-31  |  4.3 KB  |  147 lines  |  [TEXT/MPS ]

  1.  
  2. /*
  3.     File:        LayoutLibrary.h
  4.     
  5.     Contains:    layout library interface: Line Layout support routines
  6.     
  7.     Written By:    Dave Opstad, Eric Mader
  8.     
  9.     Copyright:    ©1992-1995 by Apple Computer, Inc.  All rights reserved.
  10.     
  11.     Change History (most recent first):
  12.     
  13.          <1>      1/9/95    JD        First checked in.
  14.  
  15. */
  16.  
  17. #ifndef __LAYOUTLIBRARY__
  18. #define __LAYOUTLIBRARY__
  19.  
  20. #include <GXTypes.h>
  21. #include <GXGraphics.h>
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. /* for compatibility with old headers */
  28. #define layoutLibraryIncludes
  29.  
  30. struct StyleRunOverrides {
  31.   gxPriorityJustificationOverride *priorityJustOverride;
  32.   gxGlyphJustificationOverride    *glyphJustOverrides;
  33.   long                          glyphJustOverridesCount;
  34.   gxGlyphSubstitution             *glyphSubstitutions;
  35.   long                          glyphSubstitutionsCount;
  36.   gxKerningAdjustment             *kerningAdjustments;
  37.   long                          kerningAdjustmentsCount;
  38. };
  39. typedef struct StyleRunOverrides StyleRunOverrides;
  40.  
  41. struct ParagraphRecord {
  42.   short nLayouts;
  43.   Fixed totalHeight;
  44.   gxShape layouts[gxAnyNumber];
  45. };
  46. typedef struct ParagraphRecord ParagraphRecord;    
  47. typedef struct ParagraphRecord** ParagraphRecordHandle;
  48.  
  49. struct RunFeatureTypeName {
  50.   gxRunFeatureType  featureType;
  51.   unsigned short  nSelectors;
  52.   unsigned short  selectorTableOffset;
  53.   short           nameIndex;
  54. };
  55. typedef struct RunFeatureTypeName RunFeatureTypeName;
  56.  
  57. struct RunFeatureSelectorName {
  58.   gxRunFeatureSelector  featureSelector;
  59.   short               nameIndex;
  60. };
  61. typedef struct RunFeatureSelectorName RunFeatureSelectorName;
  62.  
  63. void InitializeRunControls (gxRunControls *runControls);
  64.  
  65. void InitializeLayoutOptions (gxLayoutOptions *layoutOptions);
  66.  
  67. void InitializeStyleRunOverrides (StyleRunOverrides *overrides);
  68.  
  69. void SetDefaultPriorityJustOverride (gxPriorityJustificationOverride *override);
  70.  
  71. void SetLayoutStyle (
  72.   gxStyle             s,
  73.   char              *gxFontName,
  74.   Fixed             textSize,
  75.   gxTextAttribute     attr,
  76.   gxRunControls       *runControls,
  77.   gxRunFeature        runFeatures[],
  78.   long              runFeaturesCount,
  79.   StyleRunOverrides *overrides);
  80.  
  81. gxStyle NewLayoutStyle (
  82.   char              *gxFontName,
  83.   Fixed             textSize,
  84.   gxTextAttribute     attr,
  85.   gxRunControls       *runControls,
  86.   gxRunFeature        runFeatures[],
  87.   long              runFeaturesCount,
  88.   StyleRunOverrides *overrides);
  89.  
  90. gxShape NewSingleLayout (
  91.   char              *text,
  92.   char              *gxFontName,
  93.   Fixed             textSize,
  94.   gxLayoutOptions     *options,
  95.   gxPoint             *position,
  96.   gxTextAttribute     attr,
  97.   gxRunControls       *runControls,
  98.   gxRunFeature        runFeatures[],
  99.   long              runFeaturesCount,
  100.   StyleRunOverrides *overrides);
  101.  
  102. /* The following functions provide a limited paragraph-creation function. They make calls
  103.     to GetWidthArray and do simple gxLine-breaking using the obtained widths.
  104.     
  105.     !!! IMPORTANT NOTE FOLLOWS !!!
  106.     
  107.     These functions need to be able to deal with text in multiple scripts, which might
  108.     contain zero bytes. Therefore calls that determine hard stops (such as NewParagraph)
  109.     do NOT stop at zero bytes; this means that just passing in a single C string is NOT
  110.     sufficient! Callers will need to add a carriage return themselves to the end of the
  111.     text source. */
  112.  
  113. ParagraphRecordHandle NewParagraph(
  114.   char    *text,
  115.   gxStyle   baseStyle,
  116.   Fixed   width,
  117.   long    justified,      /* really a boolean; this way for compiler difference reasons */
  118.   Fixed   lineHeight,     /* if zero, we will deduce */
  119.   gxPoint   *firstOrigin);  /* origin of first gxLine in paragraph */
  120.  
  121. ParagraphRecordHandle NewStyledParagraph(
  122.   long                textRunCount,
  123.   const void          *text[],
  124.   const short         textRunLengths[],
  125.   long                styleRunCount,
  126.   const gxStyle         styles[],
  127.   const short         styleRunLengths[],
  128.   long                levelRunCount,
  129.   const short         levels[],
  130.   const short         levelRunLengths[],
  131.   long                totalByteCount,
  132.   const gxLayoutOptions *layoutOptions,
  133.   Fixed               lineHeight,
  134.   const gxPoint         *firstOrigin);
  135.  
  136. void DisposeParagraph(ParagraphRecordHandle paraRec);
  137.  
  138. /* GetLayoutBounds can be used to return the bounds of a layout. */
  139.  
  140. gxShape GetLayoutBounds(gxShape layout);
  141.  
  142. #ifdef __cplusplus
  143. }
  144. #endif
  145.  
  146. #endif /* __LAYOUTLIBRARY__ */
  147.